//
//#include <rtthread.h>
//
//#include "spi_flash.h"
//#include "spi_flash_sfud.h"
//#include "drv_spi.h"
//
//void filesysytem_try_mount(char *device_name, char *mount_point, char *fs_type_name, int mkfs_count);
//
////#if defined(BSP_USING_SPI_FLASH)
//
///* if BSP_USING_SPI1 then BSP_USING_SPI_FLASH will be enable  */
//static int rt_hw_spi_flash_init(void)
//{
//    /* PA4--->CS */
//    rt_hw_spi_device_attach("spi1", "spi10", GPIOA, GPIO_Pin_2);
//    if (RT_NULL == rt_sfud_flash_probe("W25Q32", "spi10"))
//    {
//        return -RT_ERROR;
//    }
//
//    filesysytem_try_mount("W25Q32","/","elm",0);
//    return RT_EOK;
//}
//INIT_COMPONENT_EXPORT(rt_hw_spi_flash_init);
//
//
//
//#undef  DBG_TAG
//#define DBG_TAG "app.filesystem"
//#define DBG_LVL DBG_INFO
//#include <rtdbg.h>
//#include <dfs.h>
//#include <dfs_fs.h>
//#include <dfs_file.h>
//
//void filesysytem_try_mount(char *device_name, char *mount_point, char *fs_type_name, int mkfs_count)
//{
//    struct statfs fs_stat;
//    int rc = 0;
//
//    LOG_I("mount(\"%s\",\"%s\",\"%s\");", device_name, mount_point, fs_type_name);
//
//    if (rt_device_find(device_name) == NULL)
//    {
//        LOG_I("%s not find!!!", device_name);
//        return;
//    }
//    mkdir(mount_point, 0);
//_remount:
//    rc = dfs_mount(device_name, mount_point, fs_type_name, 0, 0);
//    if (rc == 0)
//    {
//        LOG_I("mounted %s on %s", device_name, mount_point);
//        if (dfs_statfs(mount_point, &fs_stat) >= 0)
//        {
//            LOG_I("%s size:%d, total: %d, free: %d", mount_point,
//                  fs_stat.f_bsize, fs_stat.f_blocks, fs_stat.f_bfree);
//        }
//    }
//    else
//    {
//        if (mkfs_count > 0)
//        {
//            LOG_I("[%s]try mkfs -t %s %s ", mkfs_count, fs_type_name, device_name);
//            dfs_mkfs(fs_type_name, device_name);
//            mkfs_count--;
//            goto _remount;
//        }
//        LOG_I("mount failed :%d ", rc);
//    }
//}
//
//void filesysytem_try_unmount(char *mount_point)
//{
//    struct stat filestat = {0};
//    LOG_I("unmount(\"%s\");",  mount_point);
//    if ((dfs_file_stat(mount_point, &filestat) >= 0) && (S_ISDIR(filestat.st_mode)))
//    {
//        dfs_unmount(mount_point);
//    }
//}
//
//
////#endif
//
//
